{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lucy like banana and can eat 1.20kg\n",
      "Jack like apple and can eat 2.00 kg\n",
      "Mary like pear and can eat   2.50kg\n"
     ]
    }
   ],
   "source": [
    "print(\"Lucy like banana and can eat 1.20kg\")\n",
    "print(\"Jack like apple and can eat 2.00 kg\")\n",
    "print(\"Mary like pear and can eat   2.50kg\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lucy like   banana and can eat 1.20 kg.\n",
      "Jack like    apple and can eat 2.00 kg.\n",
      "Mary like     pear and can eat 2.50 kg.\n"
     ]
    }
   ],
   "source": [
    "fruite_weights=((\"Lucy\",\"banana\",1.2),\n",
    "               ('Jack','apple',2.0),\n",
    "               ('Mary',\"pear\",2.5))\n",
    "for fruite_weight in fruite_weights:\n",
    "    print(\"%s like %8s and can eat %.2f kg.\" % fruite_weight)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "I like orange and can eat     1.50 kg.\n"
     ]
    }
   ],
   "source": [
    "print(\"I like %s and can eat %8.2f kg.\" % (\"orange\",1.5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "must be real number, not str",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[13], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mI like \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m and can eat \u001b[39m\u001b[38;5;132;01m%8.2f\u001b[39;00m\u001b[38;5;124m kg.\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m (\u001b[38;5;241m1.5\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124morange\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n",
      "\u001b[1;31mTypeError\u001b[0m: must be real number, not str"
     ]
    }
   ],
   "source": [
    "print(\"I like %s and can eat %8.2f kg.\" % (1.5,\"orange\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.141592\n",
      "301415925.00\n",
      "Hello world\n"
     ]
    }
   ],
   "source": [
    "print(\"%f\"%3.1415925)\n",
    "print(\"%.2f\"% 301415925)\n",
    "\n",
    "print(\"%s\"% \"Hello world\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10\n",
      "12\n",
      "0o12\n"
     ]
    }
   ],
   "source": [
    "print(\"%d\"% 10)\n",
    "print(\"%o\"%10)\n",
    "print(\"%#o\"%10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a\n",
      "0xa\n",
      "A\n",
      "0XA\n"
     ]
    }
   ],
   "source": [
    "print(\"%x\"% 10)\n",
    "print(\"%#x\"%10)\n",
    "\n",
    "print(\"%X\"%10)\n",
    "print(\"%#X\"%10)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.140000e+07\n",
      "3.140000E+07\n"
     ]
    }
   ],
   "source": [
    "print(\"%e\"% 31400000)\n",
    "print(\"%E\"% 31400000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.123457\n",
      "1234\n",
      "1.23457e+06\n",
      "1.23457e+09\n"
     ]
    }
   ],
   "source": [
    "print(\"%g\"% 0.123456789)\n",
    "print(\"%g\"% 1234)\n",
    "print(\"%g\"% 1234567)\n",
    "print(\"%g\"% 1234567890)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A\n",
      "A\n",
      "a\n",
      "\u001d\n"
     ]
    }
   ],
   "source": [
    "print(\"%c\"%\"A\")\n",
    "print(\"%c\"%65)\n",
    "print(\"%c\"%\"a\")\n",
    "print(\"%c\"%29)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "31400.12\n",
      " 3.12\n"
     ]
    }
   ],
   "source": [
    "print(\"%5.2f\" % 31400.1234)\n",
    "print(\"%5.2f\" % 3.1234)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  3.123400\n",
      "3.123400  \n"
     ]
    }
   ],
   "source": [
    "print(\"%10.6f\" % 3.1234)\n",
    "print(\"%-10.6f\" % 3.1234)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  3.123400\n",
      " +3.123400\n",
      " -3.123400\n",
      " -3.123400\n"
     ]
    }
   ],
   "source": [
    "print(\"%10.6f\"% 3.1234)\n",
    "print(\"%+10.6f\"% 3.1234)\n",
    "print(\"%10.6f\"% -3.1234)\n",
    "print(\"%+10.6f\"% -3.1234)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pi=3.14159\n"
     ]
    }
   ],
   "source": [
    "pi = 3.1415926\n",
    "print(\"pi=%.*f\"%(5,pi))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "I like orange and can eat     1.50 kg.\n",
      "I like orange and can eat 1.50 kg.\n"
     ]
    }
   ],
   "source": [
    "print(\"I like %(fruit_name)s and can eat %(weight)8.2f kg.\" % {\"fruit_name\":\"orange\",\"weight\":1.5})\n",
    "print(\"I like %(fruit_name)s and can eat %(weight).2f kg.\" % {\"fruit_name\":\"orange\",\"weight\":1.5})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6 <class 'str'>\n",
      "6 <class 'int'>\n"
     ]
    }
   ],
   "source": [
    "x=\"6\"\n",
    "print(x,type(x))\n",
    "\n",
    "x=int(\"6\")\n",
    "print(x,type(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.25 <class 'str'>\n",
      "1.25 <class 'float'>\n"
     ]
    }
   ],
   "source": [
    "x=\"1.25\"\n",
    "print(x,type(x))\n",
    "x = float(\"1.25\")\n",
    "print(x,type(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4 <class 'int'>\n",
      "4 <class 'str'>\n"
     ]
    }
   ],
   "source": [
    "x = 4\n",
    "print(x,type(x))\n",
    "\n",
    "x= str(4)\n",
    "print(x,type(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n",
      "2.0 <class 'float'>\n"
     ]
    }
   ],
   "source": [
    "x=input(\"请输入一个数字：\")\n",
    "print(type(x))\n",
    "\n",
    "x= float(x)\n",
    "print(x,type(x))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "invalid literal for int() with base 10: 'a'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[31], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
      "\u001b[1;31mValueError\u001b[0m: invalid literal for int() with base 10: 'a'"
     ]
    }
   ],
   "source": [
    "int(\"a\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "字符a的ASCLL码是： 97\n",
      "字符a的ASCLL码是： 65\n",
      "字符a的ASCLL码是： 48\n"
     ]
    }
   ],
   "source": [
    "print('字符a的ASCII码是：',ord(\"a\"))\n",
    "print('字符a的ASCII码是：',ord(\"A\"))\n",
    "print('字符a的ASCII码是：',ord(\"0\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ASCII码32对应字符：  \n",
      "ASCII码65对应字符： A\n",
      "ASCII码99对应字符： c\n"
     ]
    }
   ],
   "source": [
    "print('ASCII码32对应字符：',chr(32))\n",
    "print('ASCII码65对应字符：',chr(65))\n",
    "print('ASCII码99对应字符：',chr(99))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ASCII码32的字符是：   ASCII码33的字符是： ! ASCII码34的字符是： \" ASCII码35的字符是： # \n",
      "ASCII码36的字符是： $ ASCII码37的字符是： % ASCII码38的字符是： & ASCII码39的字符是： ' \n",
      "ASCII码40的字符是： ( ASCII码41的字符是： ) ASCII码42的字符是： * ASCII码43的字符是： + \n",
      "ASCII码44的字符是： , ASCII码45的字符是： - ASCII码46的字符是： . ASCII码47的字符是： / \n",
      "ASCII码48的字符是： 0 ASCII码49的字符是： 1 ASCII码50的字符是： 2 ASCII码51的字符是： 3 \n",
      "ASCII码52的字符是： 4 ASCII码53的字符是： 5 ASCII码54的字符是： 6 ASCII码55的字符是： 7 \n",
      "ASCII码56的字符是： 8 ASCII码57的字符是： 9 ASCII码58的字符是： : ASCII码59的字符是： ; \n",
      "ASCII码60的字符是： < ASCII码61的字符是： = ASCII码62的字符是： > ASCII码63的字符是： ? \n",
      "ASCII码64的字符是： @ ASCII码65的字符是： A ASCII码66的字符是： B ASCII码67的字符是： C \n",
      "ASCII码68的字符是： D ASCII码69的字符是： E ASCII码70的字符是： F ASCII码71的字符是： G \n",
      "ASCII码72的字符是： H ASCII码73的字符是： I ASCII码74的字符是： J ASCII码75的字符是： K \n",
      "ASCII码76的字符是： L ASCII码77的字符是： M ASCII码78的字符是： N ASCII码79的字符是： O \n",
      "ASCII码80的字符是： P ASCII码81的字符是： Q ASCII码82的字符是： R ASCII码83的字符是： S \n",
      "ASCII码84的字符是： T ASCII码85的字符是： U ASCII码86的字符是： V ASCII码87的字符是： W \n",
      "ASCII码88的字符是： X ASCII码89的字符是： Y ASCII码90的字符是： Z ASCII码91的字符是： [ \n",
      "ASCII码92的字符是： \\ ASCII码93的字符是： ] ASCII码94的字符是： ^ ASCII码95的字符是： _ \n",
      "ASCII码96的字符是： ` ASCII码97的字符是： a ASCII码98的字符是： b ASCII码99的字符是： c \n",
      "ASCII码100的字符是： d ASCII码101的字符是： e ASCII码102的字符是： f ASCII码103的字符是： g \n",
      "ASCII码104的字符是： h ASCII码105的字符是： i ASCII码106的字符是： j ASCII码107的字符是： k \n",
      "ASCII码108的字符是： l ASCII码109的字符是： m ASCII码110的字符是： n ASCII码111的字符是： o \n",
      "ASCII码112的字符是： p ASCII码113的字符是： q ASCII码114的字符是： r ASCII码115的字符是： s \n",
      "ASCII码116的字符是： t ASCII码117的字符是： u ASCII码118的字符是： v ASCII码119的字符是： w \n",
      "ASCII码120的字符是： x ASCII码121的字符是： y ASCII码122的字符是： z ASCII码123的字符是： { \n",
      "ASCII码124的字符是： | ASCII码125的字符是： } "
     ]
    }
   ],
   "source": [
    "for i in range(32,126):\n",
    "    print(\"ASCII码%d的字符是：\"%i,chr(i),end=' ')\n",
    "    if i % 4 == 3:\n",
    "        print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Unicode码9900的字符是： ⚬ Unicode码9901的字符是： ⚭ Unicode码9902的字符是： ⚮ \n",
      "Unicode码9903的字符是： ⚯ Unicode码9904的字符是： ⚰ Unicode码9905的字符是： ⚱ \n",
      "Unicode码9906的字符是： ⚲ Unicode码9907的字符是： ⚳ Unicode码9908的字符是： ⚴ \n",
      "Unicode码9909的字符是： ⚵ Unicode码9910的字符是： ⚶ Unicode码9911的字符是： ⚷ \n",
      "Unicode码9912的字符是： ⚸ Unicode码9913的字符是： ⚹ Unicode码9914的字符是： ⚺ \n",
      "Unicode码9915的字符是： ⚻ Unicode码9916的字符是： ⚼ Unicode码9917的字符是： ⚽ \n",
      "Unicode码9918的字符是： ⚾ Unicode码9919的字符是： ⚿ Unicode码9920的字符是： ⛀ \n",
      "Unicode码9921的字符是： ⛁ Unicode码9922的字符是： ⛂ Unicode码9923的字符是： ⛃ \n",
      "Unicode码9924的字符是： ⛄ Unicode码9925的字符是： ⛅ Unicode码9926的字符是： ⛆ \n",
      "Unicode码9927的字符是： ⛇ Unicode码9928的字符是： ⛈ Unicode码9929的字符是： ⛉ \n",
      "Unicode码9930的字符是： ⛊ Unicode码9931的字符是： ⛋ Unicode码9932的字符是： ⛌ \n",
      "Unicode码9933的字符是： ⛍ Unicode码9934的字符是： ⛎ Unicode码9935的字符是： ⛏ \n",
      "Unicode码9936的字符是： ⛐ Unicode码9937的字符是： ⛑ Unicode码9938的字符是： ⛒ \n",
      "Unicode码9939的字符是： ⛓ Unicode码9940的字符是： ⛔ Unicode码9941的字符是： ⛕ \n",
      "Unicode码9942的字符是： ⛖ Unicode码9943的字符是： ⛗ Unicode码9944的字符是： ⛘ \n",
      "Unicode码9945的字符是： ⛙ Unicode码9946的字符是： ⛚ Unicode码9947的字符是： ⛛ \n",
      "Unicode码9948的字符是： ⛜ Unicode码9949的字符是： ⛝ Unicode码9950的字符是： ⛞ \n",
      "Unicode码9951的字符是： ⛟ Unicode码9952的字符是： ⛠ Unicode码9953的字符是： ⛡ \n",
      "Unicode码9954的字符是： ⛢ Unicode码9955的字符是： ⛣ Unicode码9956的字符是： ⛤ \n",
      "Unicode码9957的字符是： ⛥ Unicode码9958的字符是： ⛦ Unicode码9959的字符是： ⛧ \n",
      "Unicode码9960的字符是： ⛨ Unicode码9961的字符是： ⛩ Unicode码9962的字符是： ⛪ \n",
      "Unicode码9963的字符是： ⛫ Unicode码9964的字符是： ⛬ Unicode码9965的字符是： ⛭ \n",
      "Unicode码9966的字符是： ⛮ Unicode码9967的字符是： ⛯ Unicode码9968的字符是： ⛰ \n",
      "Unicode码9969的字符是： ⛱ Unicode码9970的字符是： ⛲ Unicode码9971的字符是： ⛳ \n",
      "Unicode码9972的字符是： ⛴ Unicode码9973的字符是： ⛵ Unicode码9974的字符是： ⛶ \n",
      "Unicode码9975的字符是： ⛷ Unicode码9976的字符是： ⛸ Unicode码9977的字符是： ⛹ \n",
      "Unicode码9978的字符是： ⛺ Unicode码9979的字符是： ⛻ Unicode码9980的字符是： ⛼ \n",
      "Unicode码9981的字符是： ⛽ Unicode码9982的字符是： ⛾ Unicode码9983的字符是： ⛿ \n",
      "Unicode码9984的字符是： ✀ Unicode码9985的字符是： ✁ Unicode码9986的字符是： ✂ \n",
      "Unicode码9987的字符是： ✃ Unicode码9988的字符是： ✄ Unicode码9989的字符是： ✅ \n",
      "Unicode码9990的字符是： ✆ Unicode码9991的字符是： ✇ Unicode码9992的字符是： ✈ \n",
      "Unicode码9993的字符是： ✉ Unicode码9994的字符是： ✊ Unicode码9995的字符是： ✋ \n",
      "Unicode码9996的字符是： ✌ Unicode码9997的字符是： ✍ Unicode码9998的字符是： ✎ \n"
     ]
    }
   ],
   "source": [
    "for i in range(9900,9999):\n",
    "    print('Unicode码%d的字符是：'%i,chr(i),end=' ')\n",
    "    if i % 3 == 2:\n",
    "        print()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "chr() arg not in range(0x110000)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[38], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnicode码-99对应的字符是：\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;28mchr\u001b[39m(\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m99\u001b[39m))\n",
      "\u001b[1;31mValueError\u001b[0m: chr() arg not in range(0x110000)"
     ]
    }
   ],
   "source": [
    " print('Unicode码-99对应的字符是：',chr(-99))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1, 2, 3, 4, 4, 1)\n",
      "[1, 2, 3, 4, 4, 1]\n",
      "{1, 2, 3, 4}\n"
     ]
    }
   ],
   "source": [
    "tuple1 = (1,2,3,4,4,1)\n",
    "list1 = list(tuple1)\n",
    "set1 = set(list1)\n",
    "print(tuple1)\n",
    "print(list1)\n",
    "print(set1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(('name', 'giggle'), ('height', 176))\n",
      "{'name': 'giggle', 'height': 176}\n"
     ]
    }
   ],
   "source": [
    "tuple1 = ((\"name\",\"giggle\"),(\"height\",176))\n",
    "dict1 = dict(tuple1)\n",
    "print(tuple1)\n",
    "print(dict1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "49"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x=8\n",
    "calc = \"5*x+9\"\n",
    "eval(calc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6\n"
     ]
    }
   ],
   "source": [
    "\n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable1 = 1 \n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable2 = 2  \n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable3 = 3  \n",
    "\n",
    "\n",
    "\n",
    "plusResult = thisTsvarylongvariablenamesocantwritinonelinevariable1 + \\\n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable2 + \\\n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable3\n",
    "\n",
    "print(plusResult)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (4125137573.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[50], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    plusResult=thisTsvarylongvariablenamesocantwritinonelinevariable3+\u001b[0m\n\u001b[1;37m                                                                      ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "plusResult=thisTsvarylongvariablenamesocantwritinonelinevariable3+\n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable3+\n",
    "thisTsvarylongvariablenamesocantwritinonelinevariable3\n",
    "\n",
    "print(plusResult)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "days=('Monday','Tuesday','Wednesday','Thursday',\n",
    "      'Friday','Saturday','Sunday')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "unterminated string literal (detected at line 1) (1007429295.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[55], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    days=('Monday','Tuesday','Wednesday','Thu\u001b[0m\n\u001b[1;37m                                         ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unterminated string literal (detected at line 1)\n"
     ]
    }
   ],
   "source": [
    "days=('Monday','Tuesday','Wednesday','Thu\n",
    "      rsday','Friday','Saturday','Sunday')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入体重（kg）:\n"
     ]
    }
   ],
   "source": [
    "print(\"请输入体重（kg）:\")\n",
    "weight = float(input())\n",
    "\n",
    "if weight>90:\n",
    "    print(\"胖子，该减肥啦！！！！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "ename": "IndentationError",
     "evalue": "unexpected indent (1397636180.py, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[2], line 2\u001b[1;36m\u001b[0m\n\u001b[1;33m    weight=float(input())\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n"
     ]
    }
   ],
   "source": [
    "print(\"请输入体重（kg）:\")\n",
    "     weight=float(input())\n",
    "\n",
    "if weight>90:\n",
    "    print(\"胖子，该减肥啦！！！！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入体重（kg）:\n",
      "小样，身材保持的还不错嘛！\n"
     ]
    }
   ],
   "source": [
    "print(\"请输入体重（kg）:\")\n",
    "weight = float(input())\n",
    "\n",
    "if weight>90:\n",
    "    print(\"胖子，该减肥啦！！！！\")\n",
    "else :\n",
    "    print(\"小样，身材保持的还不错嘛！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入体重（kg）:\n",
      "请输入身高（m）:\n",
      "你的BMI指数是19.53,太轻了哟\n"
     ]
    }
   ],
   "source": [
    "print(\"请输入体重（kg）:\")\n",
    "weight =float(input())\n",
    "print(\"请输入身高（m）:\")\n",
    "height=float(input())\n",
    "\n",
    "bmi=weight/height**2\n",
    "\n",
    "if bmi < 20:\n",
    "    print(\"你的BMI指数是%.2f,太轻了哟\" % bmi)\n",
    "elif bmi > 25:\n",
    "    print(\"你的BMI指数是%.2f,太重了哟\" % bmi)\n",
    "else:\n",
    "    print(\"你的BMI指数是%.2f,非常正常,请保持\" % bmi)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (3200117597.py, line 10)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[11], line 10\u001b[1;36m\u001b[0m\n\u001b[1;33m    elif bmi > 25:\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "print(\"请输入体重（kg）:\")\n",
    "weight =float(input())\n",
    "print(\"请输入身高（m）:\")\n",
    "height=float(input())\n",
    "\n",
    "bmi=weight/height**2\n",
    "\n",
    "if bmi < 20:\n",
    "    print(\"你的BMI指数是%.2f,太轻了哟\" % bmi)\n",
    "    elif bmi > 25:\n",
    "    print(\"你的BMI指数是%.2f,太重了哟\" % bmi)\n",
    "else:\n",
    "    print(\"你的BMI指数是%.2f,非常正常,请保持\" % bmi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1267650600228229401496703205376\n",
      "出现次数：0,count\n"
     ]
    }
   ],
   "source": [
    "num = 2**100\n",
    "print(num)\n",
    "\n",
    "count = 0\n",
    "while num > 0:\n",
    "    if num % 10 == 6:\n",
    "        count = count +1\n",
    "    num = num // 10\n",
    "print('出现次数：0,count')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1267650600228229401496703205376\n",
      "出现次数： 0\n"
     ]
    }
   ],
   "source": [
    "num = 2**100\n",
    "print(num)\n",
    "count = 0\n",
    "\n",
    "for digit in str(num):\n",
    "    if digit==6:\n",
    "        count = count +1\n",
    "print(\"出现次数：\",count)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "MyMLenvAllinOne",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
